package edu.gatech.cs2340.group7.wheresmystuffapp.database;

import java.util.List;

import edu.gatech.cs2340.group7.wheresmystuffapp.model.Account;
import edu.gatech.cs2340.group7.wheresmystuffapp.model.Item;

/**
 * Interface for a database
 * 
 * @author tbowling3
 * 
 */
public interface IDatabase {

	/**
	 * Adds a new account to the database.
	 * 
	 * @param newAccount
	 *            Account to be added to the database
	 * @return True if the account was successfully added and false otherwise
	 */
	public long addAccount(Account newAccount);

	/**
	 * Returns the list of items owned by a user
	 * 
	 * @param username
	 *            Name of the account to find the items for
	 * @return List of items the user has
	 */
	public List<Item> getItems(String username);

	/**
	 * Adds the item to the database
	 * 
	 * @param item
	 *            Item to be added to the database
	 * @return The result from the database insert command
	 */
	public long addItem(Item item);

	/**
	 * Deletes the account in the database
	 * 
	 * @param username
	 *            Username of the account to be deleted
	 * @return The deleted account
	 */
	public Account deleteAccount(String username);

	/**
	 * Returns the account associated with a given username
	 * 
	 * @param username
	 * @return
	 */
	public Account getAccount(String username);

	/**
	 * Updates the given account if it exists in the database. Otherwise, it
	 * will create the account
	 * 
	 * @param account
	 *            Account to be updated to the database
	 */
	public void updateAccount(Account account);

	/**
	 * Returns all items stored in the database
	 * 
	 * @return All the items in the database
	 */
	public List<Item> getAllItems();

	/**
	 * Returns all the accounts stored in the database
	 * 
	 * @return
	 */
	public List<Account> getAllAccounts();

	/**
	 * Checks to see if a username already exists in the database
	 * 
	 * @param username
	 *            Username to be checked
	 * @return True if the account is already in the database and false
	 *         otherwise
	 */
	public boolean accountExists(String username);

	/**
	 * Returns all the lost items from the database
	 * @return A list of all lost items in the database
	 */
	public List<Item> getAllLostItems();

	/**
	 * Returns all the found items from the database
	 * @return A list of all found items in the database
	 */
	public List<Item> getAllFoundItems();

	/**
	 * Returns a list of all the lost items associated with a user
	 * @param username Username to find the lost items of
	 * @return a list of all the lost items associated with a user
	 */
	public List<Item> getLostItems(String username);
	
	/**
	 * Returns a list of all the found items associated with a user
	 * @param username Username to find the found items of
	 * @return a list of all the found items associated with a user
	 */
	public List<Item> getFoundItems(String username);
	
	/**
	 * Returns a list of all the donated items associated with a user
	 * @param username Username to find the donated items of
	 * @return a list of all the donated items associated with a user
	 */
	public List<Item> getDonatedItems(String username);
	
	/**
	 * Returns a list of all the donation requested items associated with a user
	 * @param username Username to find the donation requested items of
	 * @return a list of all the donation requested items associated with a user
	 */
	public List<Item> getDonationRequestItems(String username);
	
	/**
	 * Returns a list of all the donated items from the database
	 * @return A list of all the donated items from the database
	 */
	public List<Item> getAllDonatedItems();
	
	/**
	 * Returns a list of all the donation requested items from the database
	 * @return A list of all the donation requested items from the database
	 */
	public List<Item> getAllDonationRequestItems();
}
